export default {
    state: {
        safeAreaInsets: {
            bottom: 0,
            left: 0,
            right: 0,
            top: 0
        },
        wxMenuClient: {
            bottom: 0,
            height: 0,
            left: 0,
            right: 0,
            top: 0,
            width: 0
        },
        platform: '', // 'ios' 或 'android'
        isIOS: false,
        isAndroid: false
    },
    mutations: {
        getSystemInfo(state){
            console.log("获取系统信息")
            const sysInfo = uni.getSystemInfoSync()
            const {safeAreaInsets} = uni.getWindowInfo()
            
            // 判断是iOS还是Android设备
            // 平台判断: ios, android, windows, mac, devtools
            state.platform = sysInfo.platform.toLowerCase()
            state.isIOS = state.platform === 'ios'
            state.isAndroid = state.platform === 'android'
            
            console.log("设备平台:", state.platform)
            console.log("是否iOS设备:", state.isIOS)
            console.log("是否Android设备:", state.isAndroid)
            
            state.safeAreaInsets = safeAreaInsets
            state.wxMenuClient = uni.getMenuButtonBoundingClientRect()
            console.log("窗口信息：", state.safeAreaInsets)
            console.log("小程序布局位置信息", state.wxMenuClient)
        }
    }
}